home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1993 September / September 93.iso / Archives / Applications / Text / Text Editors / Alpha 5.31 Folder / Tcl / SystemCode / flags.tcl < prev    next >
Encoding:
Text File  |  1993-02-11  |  3.4 KB  |  152 lines  |  [TEXT/ALFA]

  1. # The following three procs, together w/ the initialization 
  2. # for the flags below, allow a totally Tcl-controlled menu to 
  3. # shadow Alpha's internal variables.
  4. proc initFlag var {
  5.     global $var
  6.     addMenuItem -m Flags $var
  7.     trace vdelete $var w shadowFlag
  8.     shadowVar $var
  9.     markMenuItem Flags $var [expr ([set $var])?"on":"off"]
  10.     trace variable $var w shadowFlag
  11. }
  12.  
  13. # Called for ordinary tcl global vars we want included in the Flags menu.
  14. proc initTclFlag flag {
  15.     global $flag
  16.     addMenuItem -m Flags $flag
  17.     if {![info exists $flag]} {set $flag 0}
  18.     markMenuItem Flags $flag [expr ([set $flag])?"on":"off"]
  19.     trace variable $flag w shadowFlag
  20. }
  21.  
  22. # Called for ordinary tcl global vars we want included in the Vars menu.
  23. proc initTclVar var {
  24.     global $var
  25.     addMenuItem -m Vars $var
  26.     if {![info exists $var]} {set $var 0}
  27. }
  28.  
  29. proc shadowFlag {nm1 nm2 op} {
  30.     global $nm1
  31.     markMenuItem Flags $nm1 [expr [set $nm1]?"on":"off"]
  32. }
  33.  
  34. # 'fullNames' needs to be traced to update win menu.
  35. if {![info exists oldFNames]} {set oldFNames 0}
  36. proc shadowFullNames args {
  37.     global winNameToNum
  38.     global fullNames
  39.     global oldFNames
  40.     
  41.     if {$fullNames == $oldFNames} {return $fullNames}
  42.     set oldFNames $fullNames
  43.     
  44.     if {[catch {set nms [array names winNameToNum]}] == "1"} {
  45.         return $fullNames
  46.     }
  47.     
  48.     if {$fullNames == "1"} {
  49.         foreach name $nms {
  50.             if {$winNameToNum($name) < 10} {
  51.                 set lab /$winNameToNum($name)
  52.             } else {set lab ""}
  53.             regexp {[^:]*$} $name nm
  54.             catch {deleteMenuItem -m Wins $nm}
  55.             addMenuItem -m -l $lab Wins $name
  56.         }
  57.     } else {
  58.         foreach name $nms {
  59.             if {$winNameToNum($name) < 10} {
  60.                 set lab /$winNameToNum($name)
  61.             } else {set lab ""}
  62.             regexp {[^:]*$} $name nm
  63.             catch {deleteMenuItem -m Wins $name}
  64.             addMenuItem -m -l $lab Wins $nm
  65.         }
  66.     }
  67.     return $fullNames
  68. }
  69.  
  70. proc initVar var {
  71.     global $var
  72.     shadowVar $var
  73.     addMenuItem -m Vars $var
  74. }
  75.  
  76. # Keep 'currFileSet' up to date.
  77. trace vdelete currFileSet w shadowCurrFileSet
  78. trace variable currFileSet w shadowCurrFileSet
  79. proc shadowCurrFileSet {nm1 nm2 op} {
  80.     global fileSetNames
  81.     global currFileSet
  82.     foreach name $fileSetNames {
  83.         if {$name == $currFileSet} {
  84.             markMenuItem fileSets $name on
  85.         } else {
  86.             markMenuItem fileSets $name off
  87.         }
  88.     }
  89.     return $currFileSet
  90. }
  91.  
  92.  
  93. # This file contains methods allowing the shadowing of tcl variables 
  94.  
  95. initFlag autoSave
  96. initFlag backup
  97. initFlag backupFolder
  98. initFlag bwWindows
  99. initFlag elecLBrace
  100. initFlag elecRBrace
  101. initFlag electricSemi
  102. initFlag fullNames
  103. trace vdelete fullNames w shadowFullNames
  104. trace variable fullNames w shadowFullNames
  105. initFlag fullScreen
  106. initTclFlag iconifyOnSwitch
  107. initFlag indentOnCR
  108. initFlag moveInsertion
  109. initFlag openAllFiles
  110. initFlag optionIsMeta
  111. initFlag posActivate
  112. initFlag powerThumb
  113. initFlag projectorAware
  114. initFlag showRowCol
  115. initFlag showMenuHeads
  116. initFlag sortedIsDefault
  117. initFlag suppressHeader
  118. initFlag tempMem
  119. initFlag undoOn
  120. initFlag wordWrap
  121.  
  122. initVar backExtension
  123. initVar backupFolderName
  124. initVar bottomMargin
  125. initVar changesLim
  126. initVar defHeight
  127. initVar defWidth
  128. initVar defaultFont
  129. initVar fillColumn
  130. initVar fontSaving
  131. initVar fontSize
  132. initVar funcExpr
  133. initVar funcPar
  134. initVar funcTitle
  135. initVar leftFillColumn
  136. initVar leftMargin
  137. initVar markLabel
  138. initVar markSorting
  139. initVar numWinsToTile
  140. initVar paraColumn
  141. initVar    printerFont
  142. initVar replaceStr
  143. initVar savedState
  144. initVar searchStr
  145. initVar sortColumn
  146. initVar tabSize
  147. initVar tagFile
  148. initVar topMargin
  149. initVar wordBreak
  150. initVar wordBreakPreface
  151.  
  152.